<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.js"></script>
</head>
<body>
    <button>按钮一</button>
    <button>按钮二</button>
    <button>按钮三</button>
    <div class="box">111</div>
    <div class="box">222</div>
    <div class="box">333</div>
    <script>
        $("button").click(function(){
            $("button").css("background","");
            $(this).css("background","red");
            // 先隐藏所有的div
            $("div").css("display","none").eq($(this).index()).css("display","block");
        })




    </script>
</body>
</html>